<div ng-include src="'views/sidebar.html'"></div>
<section id="page-wrapper" ng-init="init()">
  <form class="form-inline">
    <div class="form-group">
      <div class="btn-group" role="group" aria-label="..." style="margin:10px;">
        <img src="images/laptop.png" ng-class="{false: 'btn btn-default', true: 'btn btn-primary'}[pageType==0]" ng-click="changeDeviceType(0)" style="width:50px"title="查看PC">
        <img src="images/phone.png" ng-class="{false: 'btn btn-default', true: 'btn btn-primary'}[pageType==1]"ng-click="changeDeviceType(1)" style="width:50px"title="查看H5">
        <!--<img src="images/app.png" ng-class="{false: 'btn btn-default', true: 'btn btn-primary'}[pageType==2]"ng-click="changeDeviceType(2)" style="width:50px"title="查看APP">-->
      </div>
    </div>
    <div class="form-group">
      <div class="checkbox">
        <label><input type="checkbox" ng-model="isOnlyShowMine" ng-change="search()">我管理的</label>
      </div>
    </div>
  </form>
  <form class="form-inline">
    <div class="form-group">
      最后编辑时间：
      <select class="form-control" tabindex="2" style="margin:10px;" ng-model="periodOptions" ng-change="search()">
        <option value="LAST_ONE_HOUR" label="最近一小时"></option>
        <option value="LAST_ONE_DAY" label="最近一天"></option>
        <option value="LAST_ONE_WEEK" label="最近一星期" selected></option>
        <option value="LAST_ONE_MONTH" label="最近一个月"></option>
        <option value="ALL" label="全部"></option>
      </select>
    </div>
    <div class="form-group">
      <div class="input-group custom-search-form">
        <input type="text" class="form-control ng-pristine ng-valid ng-touched" placeholder="页面名称" ng-model="searchKeywords" tabindex="0" aria-invalid="false">
        <span class="input-group-btn">
          <button class="btn btn-default" type="submit" ng-click="search()" tabindex="0">
          <i class="fa fa-search"></i>
          </button>
        </span>
      </div>
    </div>
    <div class="form-group" style="float:right">
      <div class="btn-group">
      <button type="button" class="btn btn-success" ng-click="batchUpdateProductData(pages)">批量更新商品数据</button>
      </div>
      <div class="btn-group">
        <button type="button" class="btn btn-success" ng-click="batchCreatePage(pages)">批量更新模板</button>
      </div>
    </div>
  </form>
  <hr>
  <div class="row">
    <div class="col-md-12">
     <pagination boundary-links="true" max-size="20" items-per-page="25" total-items="totalItems" ng-model="currentPage" class="pagination-sm" previous-text="&lsaquo;" next-text="&rsaquo;" first-text="&laquo;" last-text="&raquo;" ng-change="pageNumberChanged()"></pagination>
    </div>
    <div class="col-md-12">
      <table class="table table-bordered table-hover" style="margin-bottom:100px;">
        <thead>
          <tr>
            <th style="width:60px"><input type="checkbox" ng-checked="allChecked" ng-click="checkAll(pages)" ng-model="allChecked">全选</th>
            <th>页面编号</th>
            <th>类型</th>
            <th>页面名称</th>
            <th>修改时间</th>
            <th>操作</th>
          </tr>
        </thead>
        <tbody>
          <tr ng-repeat="page in pages | filter:isSearch(searchKeywords)">
            <td><input type="checkbox" ng-checked="page.checked" ng-model="page.checked"></td>
            <td>{{page.id}}</td>
            <td>
              <img src='images/laptop.png' ng-if="page.pageType==0" style="width:30px">
              <img src='images/phone.png' ng-if="page.pageType==1" style="width:30px">
              <img src='images/app.png' ng-if="page.pageType==2" style="width:30px">
            </td>
            <td>{{page.pageName}}</td>
            <td>{{page.gmtModified | date : 'yyyy-MM-dd HH:mm:ss'}}</td>
            <td>
              <div class="btn-group">
                <button type="button" class="btn btn-danger dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
                替换频道 <span class="caret"></span>
                </button>
                <ul class="dropdown-menu" ng-if="page.pageType==0">
                  <li ng-repeat="specialPage in specialPages|filter:{type: 0}" href="javascript:">
                      <a ng-click="pageRevision('{{specialPage.type}}','{{specialPage.uri}}','{{page.id}}')">更换{{specialPage.name}}</a>
                  </li>
                </ul>
                <ul class="dropdown-menu" ng-if="page.pageType==1">
                  <li ng-repeat="specialPage in specialPages|filter:{type: 1}" href="javascript:">
                      <a ng-click="pageRevision('{{specialPage.type}}','specialPage.uri','{{page.id}}')">更换{{specialPage.name}}</a>
                  </li>
                </ul>
              </div>
              <div class="btn-group">
                <a href="#/page/edit/{{page.id}}" class="btn btn-default"><i class="fa fa-sign-in"></i>装修</a></li>
              </div>
              <div class="btn-group">
                <a ng-if="page.pageType==0" href="
                  http://www.tepin.hk/preview/{{page.id}}.html
                " target="_blank" title="预览" class="btn btn-info"><i class="fa fa-link"></i>预览</a>
                <a ng-if="page.pageType!=0" href="
                  http://m.tepin.hk/preview/{{page.id}}.html
                " target="_blank" title="预览" class="btn btn-info"><i class="fa fa-link"></i>预览</a> 
              </div>
            </td>
          </tr>
        </tbody>
      </table>
    </div>
    <div class="col-md-12">
      <pagination boundary-links="true" max-size="20" items-per-page="25" total-items="totalItems" ng-model="currentPage" class="pagination-sm" previous-text="&lsaquo;" next-text="&rsaquo;" first-text="&laquo;" last-text="&raquo;" ng-change="pageNumberChanged()"></pagination>
    </div>
  </div>
</section>
<div ng-include src="'views/page/page.property.edit.html'"></div>
